//destructor example

#include <iostream>
using namespace std;
 
class Destroyer {
public:
  //constructor
  Destroyer() { 
     cout << "constructor called!\n";
  } 
  //destructor
  ~Destroyer() { 
    cout << "\ndestructor called!";
  }
};
 
int main() {
        Destroyer array[ 3 ];
        //when main terminates, destructor will be called
}
